<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
</head>
<style type="text/css">
</style>
<form class="mui-input-group">
	<div class="mui-input-row">
		<label>登录账号:</label> <input type="text" class="loginName"
			id="loginName" disabled="disabled" placeholder="登录账号"> <input
			type="hidden" class="managerId" name="managerId"> <span
				class="must">不能修改</span>
	</div>
	<div class="mui-input-row">
		<label>真实姓名:</label> <input type="text" class="realName"
			name="realName" placeholder="真实姓名">
	</div>
	<div class="mui-input-row">
		<label>手机号码:</label> <input type="text" class="mobilePhone"
			name="mobilePhone" placeholder="请输入手机号码">
	</div>
	<div class="mui-input-row">
		<label>邮箱:</label> <input type="text" class="email" name="email"
			placeholder="请输入邮箱">
	</div>
	<style>
.changePass {
	position: relative;
	width: 100%;
}

.changePass div {
	position: absolute;
	left: 30%;
	top: 0px;
}

.changePass div+div {
	position: absolute;
	left: 60%;
	top: 0px;
}
</style>
	<div class="mui-input-row mui-radio mui-left changePass">
		<span style="margin: 10px 15px; display: block;">重置密码:</span>
		<div>
			<input name="flag" value="1" type="radio"> <label>是</label>
		</div>
		<div>
			<input name="flag" value="0" type="radio" checked="checked">
				<label>否</label>
		</div>
	</div>
	<div class="mui-input-row">
		<label>选择角色:</label> <select name="roleId" class="selectPayType">
			<c:forEach items="${list }" var="list">
				<c:if test="${list.flag==1}">
					<option value="${list.roleId }" selected="selected">${list.name }</option>
				</c:if>
				<c:if test="${list.flag==0}">
					<option value="${list.roleId }" selected="selected">${list.name }</option>
				</c:if>
			</c:forEach>
		</select>
	</div>
	<div class="mui-button-row">
		<a class="mui-btn mui-btn-primary submit">提交</a>
	</div>
</form>
<script type="text/javascript">
		mui('#offCanvasContentScroll').scroll().scrollTo(0,0);
		
		$(".mui-title").html("管理员修改")
		var admin = sessionStorage.getItem('admin');
		admin = JSON.parse(admin);
		$(".managerId").attr("value",admin.managerId);
		$(".loginName").val(admin.loginName);
		$(".realName").val(admin.realName);
		$(".mobilePhone").val(admin.mobilePhone);
		$(".email").val(admin.email);
	
	   $(".submit").on("touchstart",function(){
		   var param = $("form").serialize();

		   let loginName = $(".loginName").val();
	    	
	    	if(loginName !== ""){
				$.post("/main/updateUserLogin",param,function(res){
					
					if(res.success){
						mui.toast("添加成功");
						history.back();
			    	}else{
			    		mui.toast(res.message);
			    	}
					
				})
	    	}else{
	    		mui.toast("带 "+'<span style="color:red;">*</span> 为必填项');
	    	}
	   })
	   
	</script>
</html>